﻿using MediatR;
using Warehouse.Domain;
using Warehouse.Infrstructre.Interface;
using Warehouse.Read.API.Applcation.Command.WarehouseCommand;

namespace Warehouse.Read.API.Applcation.CommandHandlers.WarehouseCommandHandlers
{
    public class FillWarehouseCommandHandlers : IRequestHandler<FillWarehouseCommand, Warehouseinfo>
    {
        private readonly IWarehouseRepository _warehouse;

        public FillWarehouseCommandHandlers(IWarehouseRepository warehouse)
        {
            _warehouse = warehouse;
        }

        public async Task<Warehouseinfo> Handle(FillWarehouseCommand request, CancellationToken cancellationToken)
        {
            return await _warehouse.GetModelAsync(request.Id);
        }
    }
}
